//统一管理用户请求相关api
//引入自己封装的axios对象
import request from "@/utils/request";
import type { schoolAddResponseData, schoolAllResponseData, schoolInfoData, schoolPageData, schoolPageResponseData, schoolRemoveResponseData,  } from "./type";

//定义用户相关的请求地址
//@ts-ignore
enum API{
    // 样例:LOGIN_URL = "/login",
    ADD_SCHOOL = "/manage/school/add",
    FIND_BY_ID = "/manage/school/find",
    UPDATE_SCHOOL = "/manage/school/update",
    PAGE_SCHOOL = "/manage/school/list",
    REMOVE_SCHOOL = "/manage/school/delete",
    ALL_SCHOOL = "/manage/school/all"
}
// //登录请求接口        样例
// export const reqLogin = (data:loginFormData)=>request.post<any,loginResponseData>(API.LOGIN_URL,data);
// //通过id获取用户
// export const reqUserFindById = (_id:string)=>request.get<any,userAddResponseData>(API.FIND_BY_ID+`?_id=${_id}`)
//添加学校
export const reqSchoolAdd = (data:schoolInfoData)=>request.post<any,schoolAddResponseData>(API.ADD_SCHOOL,data);
//根据id查询学校
export const reqSchoolFindById = (_id:string)=>request.get<any,schoolAddResponseData>(API.FIND_BY_ID+`?_id=${_id}`);
//更新学校
export const reqSchoolUpdate = (data:schoolInfoData)=>request.post<any,schoolAddResponseData>(API.UPDATE_SCHOOL,data);
//获取学校列表(分页)
export const reqSchoolPage = (data:schoolPageData)=>request.post<any,schoolPageResponseData>(API.PAGE_SCHOOL,data);
//获取所有学校
export const reqSchoolAll = ()=>request.get<any,schoolAllResponseData>(API.ALL_SCHOOL);
//删除学校
export const reqSchoolRemove = (schoolId:string)=>request.post<any,schoolRemoveResponseData>(API.REMOVE_SCHOOL,{schoolId});


